#pragma once
#include "IManager.h"
#include "IResource.h"
#include <boost\intrusive_ptr.hpp>
#include <hash_map>
#include "Error.h"

namespace DarkStorm2D {

template <class Res> class DLLDARKSTORM2D IResourceManager : public IResource
{
protected:
	std::hash_map<std::string,boost::intrusive_ptr<Res>> m_ResourceMap;
	bool m_IsLoad;
public:

	IResourceManager() {}

	~IResourceManager() {}

	virtual bool ReloadAll() = NULL;
	virtual bool Reload(const std::string & Name) = NULL;

	virtual bool IsLoad() = NULL;

	virtual void SetFilename(const std::string & Name, const std::string & FileName) = NULL;
	virtual const std::string & GetFilename(const std::string & Name) = NULL;

	virtual bool AddFromFile(const std::string & Name, const std::string & FileName, bool MultiName =  false) = NULL; 

	virtual bool AddFromMemory(const std::string & Name, boost::intrusive_ptr<Res> Resource, bool MultiName =  false) = NULL;

	virtual boost::intrusive_ptr<Res> GetResource(const std::string Name) = NULL;

	virtual bool Remove(const std::string & Name) = NULL;
	virtual bool RemoveAll() = NULL;

	virtual boost::intrusive_ptr<Res> operator[] (const std::string Name) {return m_ResourceMap[Name];}
};

};

